package Models::db::Content;

#use lib 'd:/test_project/lib/';
use strict;
use DBI; 
  

	sub trim
	{
		my $string = shift;
		$string =~ s/^\s+//;
		$string =~ s/\s+$//;
		return $string;
	}
	
	sub new {
		my $check = shift;
		my $arr = shift; 
		my $class = ref($check) || $check;
		my $self = { status => 1};
		if ($arr) {
			$self->{Columns} = {
				id 			=> $$arr{id},
				language		=> $$arr{language},
				active 			=> $$arr{active},
				code  			=> trim($$arr{code}),
				title  			=> trim($$arr{title}),
				text  			=> $$arr{text},
				meta_title		=> trim($$arr{meta_title}),
				meta_description	=> trim($$arr{meta_description}),
				meta_keywords	 	=> trim($$arr{meta_keywords}),
			};
		} else {
			$self->{Columns} = {
				id 			=> undef,
				language		=> undef,
				active 			=> undef,
				code  			=> undef,
				title  			=> undef,
				text  			=> undef,
				meta_title 		=> undef,
				meta_description	=> undef,
				meta_keywords	 	=> undef,
			};
		}
		return bless($self, $class);
	}
	
	sub getContent {
		my $self = shift;
		return $self->{Columns};	
	}
  
	sub getId {
		my $self = shift;
		return $self->{Columns}{id};	
	}
	
	sub getLanguage {
		my $self = shift;
		return $self->{Columns}{language};	
	}
  
	sub getCode {
		my $self = shift;
		return $self->{Columns}{code};	
	}
  
  
	sub getActive {
		my $self = shift;
		return $self->{Columns}{active};	
	}
  
	sub getTitle {
		my $self = shift;
		return $self->{Columns}{title};	
	}
  
	sub getText {
		my $self = shift;
		return $self->{Columns}{text};	
	}
  
	sub getMetaTitle {
		my $self = shift;
		return $self->{Columns}{meta_title};	
	}
  
	sub getMetaDescription {
		my $self = shift;
		return $self->{Columns}{meta_description};	
	}
	
	sub getMetaKeywords {
		my $self = shift;
		return $self->{Columns}{meta_keywords};	
	}

1;